{include file="public/_header.html"}

<body style="margin:0px auto 0px; auto; padding:0px;">
<div id="outer" style="width:650px; cursor:default; margin:0px auto 0px; auto; padding:0px;">
<table class="border2" style="width: 100%;" cellpadding="4" cellspacing="0">
<tr>
	<td>
	<table style="width: 100%;" class="mainmenu5" cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td width="7"><img src="design/pic/spacer.gif" class="sqr1" alt="" height="7" width="7" /></td>
		<td class="block_header"><div id="user_data"></div></td>
	</tr>
	</table>

	<table style="width:100%; height:300px;">
	<tr>
	<td style="vertical-align:top;" class="border2">
	{if $bUserIsOffline}
	<div style="padding:6px;">
		{language text='Mod_Account.before_you_chat'}
		<p>
			<input onclick="window.location.href='{url link='public.account.messenger'}';" style="cursor: pointer;" value="{language text='Mod_Account.login_now'}" type="button" class="mainmenu6" onmouseover="this.className='mainmenu7';" onmouseout="this.className='mainmenu6';">
			<input onclick="window.close();" style="cursor: pointer;" value="{language text='Mod_Account.close_window'}" type="button" class="mainmenu6" onmouseover="this.className='mainmenu7';" onmouseout="this.className='mainmenu6';">
		</p>
	</div>
	{elseif $bIsOffline}
	<div style="padding:6px;">
		{language text='Mod_Account.is_not_logged' replace=$aUser.user}
		<p>
			<input onclick="window.opener.document.location.href='{url link='public.account.messages.compose' user=$aUser.user}'; window.close();" style="cursor: pointer;" value="{language text='Mod_Account.send_private_message'}" type="button" class="mainmenu6" onmouseover="this.className='mainmenu7';" onmouseout="this.className='mainmenu6';">
			<input onclick="window.close();" style="cursor: pointer;" value="{language text='Mod_Account.close_window'}" type="button" class="mainmenu6" onmouseover="this.className='mainmenu7';" onmouseout="this.className='mainmenu6';">
		</p>		
	</div>
	{else}	
	<div id="chat_content_div" style="overflow:auto; height:300px;">
		<div id="chat_content"></div>
		<div id="system_message"></div>
	</div>
	{/if}
	</td>
	<td style="width:125px; vertical-align:top; text-align:center;" class="border13">

		<div style="padding:10px;">
		<a href="{url link='public.user' name=$aUser.user}" target="_blank">
			{Account::Avatar sUser=$aUser.user iSize=120 class="pic1" onmouseover="showInfo5('`$aUser.profile_info`', '', '');this.className='pic2';" onmouseout="this.className='pic1';return nd();"}
		</a>
		</div>

	</td>
	</tr>
	</table>

	{if !$bIsOffline && !$bUserIsOffline}
	<table style="width:100%;">
	<tr>
		<td colspan="2">
		{include file="$sSmartyTemplateDir/_blocks/smilies.html"}
		</td>
	</tr>
	<tr>
		<td>
		<textarea cols="60" rows="9" style="width:90%;" id="maintext" name="maintext" onkeyup="return (!entsub(event)) ? false : entsub(event);"></textarea>
		</td>
		<td>
		<input type="submit" value="{language text='Mod_Chat.send'}" style="cursor:pointer;" onclick="submitAjaxForm();" />
		</td>
	</tr>
	</table>	
	{/if}

	</td>
</tr>
</table>
</div>
<script type="text/javascript">xajax_getImStatus('{$iUserId}', '{$iRoomId}');</script>
<script type="text/javascript">xajax_getMessages('{$iRoomId}');</script>
<script type="text/javascript">
{literal}

function submitAjaxForm()
{
	tinyMCE.triggerSave(false, false);
	tinyMCE.execCommand('mceSetContent',false, '');
	{/literal}
	xajax_addMessage('{$iRoomId}', document.getElementById('maintext').value, '{$aUser.user}');
	{literal}
	return false;
}

function entsub(event)
{
	var Key = event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode);

	if (Key == 13)
	{
		submitAjaxForm();
		return false;
	}
	else
	{
        return true;
	}
}

{/literal}
</script>
<div id="bg_sound"></div>
</body>
</html>